package com.example.myandroidtest.ui.custom;

import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.viewpager.widget.ViewPager;

public class MyLayout extends ViewGroup {
    ViewGroup viewGroup;
    View view;

    ViewPager viewPager;
    ListView listView;

    public MyLayout(Context context) {
        super(context);
    }

    //Activity-> PhoneWindow-> DecorView-> ViewGroup-> View
    //onTouch onClick谁先调用

    //分发
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return super.dispatchTouchEvent(ev);

        //第一步 判断是否拦截子View
        //第二步 分发事件给子View 看哪个子view处理事件
        //第三步 执行事件  dispatchTransformedTouchEvent

//        dispatchTransformedTouchEvent(ev);
    }


    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return super.onTouchEvent(event);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
    }

    //拦截

}
